extends IInputAction


class_name InputMouse


## 鼠标按键类型
@export var button_index: MouseButton = MOUSE_BUTTON_NONE


func __get_mouse(e: InputEvent) -> InputEventMouseButton:
    if e is InputEventMouseButton:
        var mouse: InputEventMouseButton = e as InputEventMouseButton
        if mouse.button_index == button_index:
            return mouse
    return null

func __is_input_pressed(e: InputEvent) -> bool:
    var mouse: InputEventMouseButton = __get_mouse(e)
    if mouse:
        return mouse.pressed
    return false

func __is_input_released(e: InputEvent) -> bool:
    var mouse: InputEventMouseButton = __get_mouse(e)
    if mouse:
        return not mouse.pressed
    return false
